<!DOCTYPE html>
<html>

<head>
	<meta charset="utf-8">
	<title>商品订单管理</title>
	<meta name="renderer" content="webkit">
	<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
	<meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1">
	<meta name="apple-mobile-web-app-status-bar-style" content="black">
	<meta name="apple-mobile-web-app-capable" content="yes">
	<meta name="format-detection" content="telephone=no">
	<link rel="stylesheet" href="${s.base}/js/layui/css/layui.css" media="all" />
	<link rel="stylesheet" href="${s.base}/css/base/base.css" media="all" /></head>

<body class="childrenBody">
<form class="layui-form">
	<blockquote class="layui-elem-quote quoteBox" id="tool">
		<div class="layui-inline">
			<!-- 时间控制，开始时间和结束时间 -->
			<label class="layui-input-inline">时间</label>
			<label class="layui-input-inline">
				<input type="text" class="layui-input" id="nowDay" name="nowDay" placeholder="请选择时间" />
			</label>

			<label class="layui-input-inline">描述</label>
			<label class="layui-input-inline">
				<input type="text" class="layui-input" name="description" placeholder="请输入描述" />
			</label>
			<a class="layui-btn search_btn" lay-submit="" lay-filter="seacherBtn">搜索</a>
			<!--<a class="layui-btn export_btn" lay-submit="" >导出</a>-->
		</div>
	</blockquote>
	<table id="entityList" lay-filter="entityList"></table>
</form>

<script type="text/javascript" src="${s.base}/js/layui/layui.js"></script>
<script type="text/javascript" src="${s.base}/js/base/base.js"></script>
<script type="text/javascript">layui.use(['jquery', 'pageUtil', 'dialogUtil', 'table','laydate', 'dateUtil'],
    function() {
        var $ = layui.jquery,
            dateUtil = layui.dateUtil,
            dialogUtil = layui.dialogUtil,
            table = layui.table,
            laydate = layui.laydate,
            pageUtil = layui.pageUtil;
        var tableIns = null;

        laydate.render({
            elem: '#nowDay'
            //,type: 'date' //默认，可不填
        });

        var url = "/shopOrder/page";
        var cols = [{
            type: 'checkbox',
            fixed: 'left'
        },
		{
			type: 'numbers',
			title: '序号'
		},
		{
			field: 'num',
			title: '数量',
			align: 'center'
		},
		{
			field: 'money',
			title: '金额',
			align: 'center'
		},
		{
			field: 'description',
			title: '描述',
			align: 'center'
		},
		{
			field: 'createTime',
			title: '创建时间',
			width: 190,
			align: 'center',
			templet: function(d) {
				return dateUtil.formatDate(new Date(d.createTime), "yyyy-MM-dd hh:mm:ss");
			}
		},
		{
			title: '操作',
			width: 200,
			align: "center",
			fixed: 'right',
			templet: function (d) {
					return '<a class="layui-btn cy-btnbg-edit layui-btn-sm" lay-event="show"> 查看 </a>';
			}
		}];
        tableIns = pageUtil.initDate(cols, url, true);

        // 导出
		$(".export_btn").on("click",function(){
			var checkStatus = layui.table.checkStatus('entityList').data;
			if(checkStatus.length == 0){
				layer.alert("请选择至少一个订单！")
				return false;
			}
			var ids = [];
			$.each(checkStatus,function(i,v){
				ids.push(v.id);
			});
			if(ids.length > 1){
				layer.alert("您只能选择一个导出！")
				return false;
			}
			window.location.href = "/shopOrder/export?orderId="+ids[0];
		});

        table.on('tool(entityList)',
            function(obj) {
                var layEvent = obj.event,
                    data = obj.data;
                if (layEvent === 'show') {
                    parent.tabAddUrl("/shopOrderCoupon/shopOrderCouponShowList?orderId="+data.id,"订单详情");
					// window.location.href = "/shopOrderCoupon/shopOrderCouponShowList?orderId="+data.id;
                }
            });
    })</script>
</body>

</html>